<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html>
<head>
    <title>首页</title>
    <link rel="stylesheet" type="text/css" href="jquery-easyui-1.10.2/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="jquery-easyui-1.10.2/themes/icon.css">
    <link rel="stylesheet" href="ztree/css/zTreeStyle/zTreeStyle.css" type="text/css">
    <link rel="stylesheet" type="text/css" href="resources/css/wu.css">
    <script type="text/javascript" src="jquery-easyui-1.10.2/jquery.min.js"></script>
    <script type="text/javascript" src="ztree/js/jquery.ztree.all.js"></script>
    <script type="text/javascript" src="jquery-easyui-1.10.2/jquery.easyui.min.js"></script>
    <%--    <script type="text/javascript" src="ztree/js/jquery-1.4.4.min.js"></script>--%>
    <script type="text/javascript" src="resources/car.js"></script>
    <script type="text/javascript" src="resources/echarts.js"></script>
    <script type="text/javascript" src="jquery-easyui-1.10.2/datagrid-detailview.js"></script>
</head>
<body>
<div class="easyui-layout" style="width:100%;height:100%;" fit="true">
    <div data-options="region:'north'" style="height:60px" class="wu-header">
        <div class="wu-header-left">
            <h1>行天下汽车出租系统</h1>
        </div>
        <div class="wu-header-right">
            <p>
                <strong class="easyui-tooltip" title="2条未读消息">欢迎：${sessionScope.unm}</strong>
            </p>
            <p>
                <a href="#">网站首页</a>|
                <a href="#">支持论坛</a>|
                <a href="#">帮助中心</a>|
                <a href="index.jsp">安全退出</a>
            </p>
        </div>
    </div>
    <div data-options="region:'west',split:true" title="菜单" style="width:190px;">
        <div id="treeDemo" class="ztree"></div>
    </div>
    <div data-options="region:'center'" id="tt" class="easyui-tabs">
        <div href="toP/desk" title="新闻公告" data-options="closable:true,iconCls:'icon-add'"></div>
    </div>
    <div data-options="region:'south',split:true" style="height:30px;" class="wu-footer">
        <div align="center">&copy; 2022 JYC All Rights Reserved</div>
    </div>
</div>
<script>
    $(document).ready(function () {
        var setting = {
            data: {
                simpleData: {
                    enable: true,
                    pIdKey: "pid"
                }
            },
            callback:{
                onClick:zTreeOnClick
            }
        };
        $.get("${pageContext.request.contextPath}/getMenus2", function (zNodes) {
            $.fn.zTree.init($("#treeDemo"), setting, zNodes);
        },"json")
    });

    function zTreeOnClick(event, treeId, treeNode) {
        if (!treeNode.isParent){
            if(!$("#tt").tabs('exists',treeNode.name)){
                $("#tt").tabs('add',{
                    title:treeNode.name,
                    href:treeNode.href,
                    closable:true,
                    iconCls:treeNode.tabicon
                });
            }else {
                $("#tt").tabs('select',treeNode.name)
            }
        }
    }
</script>
</body>
</html>
